From d1697f868e047f1355fed7b44dbcd6dda897c234 Mon Sep 17 00:00:00 2001
From: Adrian Perez de Castro <aperez@igalia.com>
Date: Thu, 19 Sep 2019 17:13:19 +0300
Subject: [PATCH xserver 1/1] [GTK] ANGLE's eglplatform.h is build broken with
 -DENABLE_X11_PLATFORM=OFF https://bugs.webkit.org/show_bug.cgi?id=198621

Reviewed by NOBODY (OOPS!).

* PlatformGTK.cmake: Use WL_EGL_PLATFORM to prefer Wayland type
definitions with ENABLE_WAYLAND_TARGET, and USE_SYSTEM_EGL otherwise
when ENABLE_X11_TARGET is not enabled.

Fetch from: https://bugs.webkit.org/show_bug.cgi?id=198621
Upstream-Status: Pending
Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>

---
 Source/ThirdParty/ANGLE/ChangeLog         | 11 +++++++++++
 Source/ThirdParty/ANGLE/PlatformGTK.cmake |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/Source/ThirdParty/ANGLE/PlatformGTK.cmake b/Source/ThirdParty/ANGLE/PlatformGTK.cmake
index 74f35e29234..7229b0e09cc 100644
--- a/Source/ThirdParty/ANGLE/PlatformGTK.cmake
+++ b/Source/ThirdParty/ANGLE/PlatformGTK.cmake
@@ -1,2 +1,11 @@
 # Enable GLSL compiler output.
 list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL)
+
+if (ENABLE_WAYLAND_TARGET)
+    # Explicitly prefer the Wayland platform, otherwise if we are building
+    # in a system without X11 ANGLE will still try to use the X11 headers.
+    list(APPEND ANGLE_DEFINITIONS WL_EGL_PLATFORM)
+elseif (NOT ENABLE_X11_TARGET)
+    # Allow building ANGLE on platforms which may not provide X11 headers.
+    list(APPEND ANGLE_DEFINITIONS USE_SYSTEM_EGL)
+endif ()
-- 
2.23.0

